Avoid misleading message about 'not using swiotlb' on x86/64
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 10 Feb 2006 11:35:19 +0000 (12:35 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 10 Feb 2006 11:35:19 +0000 (12:35 +0100)
domain0. Provide a temporary glue between our swiotlb
implementation and x86/64's dma_ops dynamic dma-mapping
infrastructure.

Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/x86_64/kernel/Makefile
linux-2.6-xen-sparse/arch/x86_64/kernel/pci-swiotlb-xen.c [new file with mode: 0644]
linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c

index 4804676e0932e5984fb3106f5aebda33163a0fdd..56fb604735b5ba8de57603479079244320682288 100644 (file)
@@ -59,7 +59,7 @@ pci-dma-y                     += ../../i386/kernel/pci-dma-xen.o
 microcode-$(subst m,y,$(CONFIG_MICROCODE))  := ../../i386/kernel/microcode-xen.o
 quirks-y                       := ../../i386/kernel/quirks-xen.o
 
-n-obj-xen := i8259.o reboot.o i8237.o smpboot.o trampoline.o pci-swiotlb.o
+n-obj-xen := i8259.o reboot.o i8237.o smpboot.o trampoline.o
 
 include $(srctree)/scripts/Makefile.xen
 
diff --git a/linux-2.6-xen-sparse/arch/x86_64/kernel/pci-swiotlb-xen.c b/linux-2.6-xen-sparse/arch/x86_64/kernel/pci-swiotlb-xen.c
new file mode 100644 (file)
index 0000000..4763ff4
--- /dev/null
@@ -0,0 +1,54 @@
+/* Glue code to lib/swiotlb.c */
+
+#include <linux/pci.h>
+#include <linux/cache.h>
+#include <linux/module.h>
+#include <asm/dma-mapping.h>
+#include <asm/proto.h>
+#include <asm/swiotlb.h>
+#include <asm/dma.h>
+
+#if 0
+int swiotlb __read_mostly;
+EXPORT_SYMBOL(swiotlb);
+#endif
+
+struct dma_mapping_ops swiotlb_dma_ops = {
+#if 0
+       .mapping_error = swiotlb_dma_mapping_error,
+       .alloc_coherent = swiotlb_alloc_coherent,
+       .free_coherent = swiotlb_free_coherent,
+       .map_single = swiotlb_map_single,
+       .unmap_single = swiotlb_unmap_single,
+       .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
+       .sync_single_for_device = swiotlb_sync_single_for_device,
+       .sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
+       .sync_single_range_for_device = swiotlb_sync_single_range_for_device,
+       .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
+       .sync_sg_for_device = swiotlb_sync_sg_for_device,
+       .map_sg = swiotlb_map_sg,
+       .unmap_sg = swiotlb_unmap_sg,
+       .dma_supported = NULL,
+#endif
+};
+
+void pci_swiotlb_init(void)
+{
+#if 0
+       /* don't initialize swiotlb if iommu=off (no_iommu=1) */
+       if (!iommu_aperture && !no_iommu &&
+           (end_pfn > MAX_DMA32_PFN || force_iommu))
+              swiotlb = 1;
+       if (swiotlb) {
+               swiotlb_init();
+               printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
+               dma_ops = &swiotlb_dma_ops;
+       }
+#else
+       swiotlb_init();
+       if (swiotlb) {
+               printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
+               dma_ops = &swiotlb_dma_ops;
+       }
+#endif
+}
index e8a1ca0b434d136f403b4795e37a781ea349b909..b1f96da92c2a893e0a28e2f6d35a520dec94a280 100644 (file)
@@ -869,7 +869,7 @@ void __init mem_init(void)
        memset(contiguous_bitmap, 0, (end_pfn + 2*BITS_PER_LONG) >> 3);
 
 #if defined(CONFIG_SWIOTLB)
-       swiotlb_init(); 
+       pci_swiotlb_init();     
 #endif
        no_iommu_init();